<div class="auth-block">
  <div class="loading" *ngIf="loading"></div>

  <form class="form-horizontal" (ngSubmit)="onSubmit()" #form="ngForm">
		<div class="form-group form-title row">
			<h2>{{title}}</h2>
		</div>

		<div class="form-group row" [class.has-error]="name.invalid && name.dirty">
			<label for="username" class="col-sm-3 control-label">用户名</label>
			<div class="col-sm-9">
				<input type="text" class="form-control" id="username" name="username" maxlength="15" required
				[(ngModel)]="loginForm.username" #name="ngModel">
				<span [hidden]="name.valid || name.pristine" class="error-info">请填写用户名</span>
			</div>
		</div>

		<div class="form-group row" [class.has-error]="password.invalid && password.dirty">
			<label for="password" class="col-sm-3 control-label">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>

			<div class="col-sm-9">
				<input type="password" class="form-control" id="password" name="password" maxlength="15" required
				[(ngModel)]="loginForm.password" #password="ngModel">

				<span [hidden]="password.valid || password.pristine" class="error-info">请填写密码</span>
			</div>
		</div>

		<div class="form-group row" [class.has-error]="authCode.invalid && authCode.dirty">
			<label for="authCode" class="col-sm-3 control-label">验证码</label>

			<div class="col-sm-6">
				<input type="text" class="form-control" id="authCode" name="authCode" maxlength="10" required
				[(ngModel)]="loginForm.authCode" #authCode="ngModel">
				<span [hidden]="authCode.valid || authCode.pristine" class="error-info">请填写验证码</span>
			</div>
			<div class="col-sm-3" id="authCodeContainer">
				<img class="authCodeImg" [src]="authCodeImg" (click)="updateAuthImg()">
			</div>
		</div>

		<div class="row" *ngIf="loginError">
			<span class="error-info">{{errorMsg}}</span>
		</div>

		<div class="form-group row">
			<div class="col-sm-12">
				<button type="submit" class="btn btn-auth" [disabled]="!form.form.valid&&loginBtn">登录</button>
			</div>
		</div>
    <div class="form-group row">
      <div class="col-sm-offset-2  col-sm-12">
        <span *ngIf="registerRouter" class="register-label pull-left"><a routerLink="{{registerRouter}}">注册账号</a></span>
        <span class="return-select-label pull-left"><a routerLink="/login">返回</a></span>
        <span *ngIf="(userType === 'user') || (userType === 'company')" class="return-select-label pull-left"><a routerLink="{{directReset}}">忘记密码？</a></span>
      </div>
    </div>
	</form>
</div>
